package com.taotao.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.taotao.common.utils.JsonUtils;
import com.taotao.service.IPictureService;

@Controller
@RequestMapping(value = "/pic")
public class PictureController {
	@Autowired
	private IPictureService pictureService;

	@RequestMapping("/upload")
	@ResponseBody
	public String upload(
			@RequestParam(value = "uploadFile") MultipartFile multipartFile) {
		Map<String, Object> result = this.pictureService
				.uploadPicture(multipartFile);
		return JsonUtils.objectToJson(result);
	}
}
